﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GONES.IBLL;
using GONES.Tools.Common;
using GONES.Model;

public partial class Console_System_SysLog_SysLogList : CPage
{

    public string DetailString {get;set;}
    public string BgtimeString { get; set; }
    public string EdtimeString { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        BindData();
    }

    /// <summary>
    /// 数据绑定，同时需要设置数据总条数
    /// 当前页与每页条数由页面中的pagerForm回传得到
    /// </summary>
    private void BindData()
    {
        DetailString = Request.Form["txtDetail"];        
        BgtimeString = Request.Form["txtBgtime"];
        EdtimeString = Request.Form["txtedtime"] ; 
        var logManager = AppContext.GetObject("S_LogManager") as IS_LogManager;
        IList<DataFilter> dataFilters = new List<DataFilter>();
        if (!string.IsNullOrEmpty(DetailString))
        {
            DataFilter df = new DataFilter() { Type = "string", Value = DetailString, Field = "Detail" };
            df.Comparison = "like";
            dataFilters.Add(df);
        }
        if (!string.IsNullOrEmpty(BgtimeString))
        {
            DataFilter df = new DataFilter() { Type = "date", Value = BgtimeString, Field = "CreateTime" };
            df.Comparison = "gt";
            dataFilters.Add(df);
        }
        if (!string.IsNullOrEmpty(EdtimeString))
        {
            DataFilter df = new DataFilter() { Type = "date", Value = EdtimeString, Field = "CreateTime" };
            df.Comparison = "lt";
            dataFilters.Add(df);
        }

        long recordCount = TotalCount;
        IList<S_Log> log = logManager.SelfList(dataFilters, PageNum, NumPerPage, ref recordCount);
        RepeaterTr.DataSource = log;
        RepeaterTr.DataBind();
        TotalCount = recordCount;
    }


}